package com.mvvm.store.roombatabase;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.mvvm.store.bean.basebean.ScanStockBean;
import com.mvvm.store.bean.basebean.StockUpScanInfoBean;

@Database(entities = {ScanStockBean.class},version=1,exportSchema = false)
public abstract class ScanStockDatabase extends RoomDatabase {

private static final String DB_NAME = "ScanStock.db";
private static volatile ScanStockDatabase instance;

    /**
     * 标签 bao
     * @param context
     * @return
     */
    public static synchronized ScanStockDatabase getInstance(Context context) {
    if (instance == null) {
        instance = create(context);
    }
    return instance;
    }

    private static ScanStockDatabase create(final Context context) {
    return Room.databaseBuilder(
            context,
            ScanStockDatabase.class,
            DB_NAME)
            .allowMainThreadQueries()
            .build();

}



    public abstract ScanStockDao scanStockDao();


}
